package com.houger.ddd.redpacket.infra.mq;

import com.alibaba.fastjson.JSON;
import com.houger.ddd.redpacket.domain.GrabRedPacketDomain;
import com.houger.ddd.redpacket.infra.mq.kafka.Producer;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

/**
 * @author Houger.
 * @date 2024年04月19日 16:06.
 */
@Slf4j
@Repository
public class RedPackerKafkaProducer {
    @Resource
    Producer producer;
    public void send(final GrabRedPacketDomain domain) {
        producer.sendMessage("rd_grab", JSON.toJSONString(domain));
        log.info("发送mq succ,domain={}",domain);
    }
}
